import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';
//单条查询
export const queryGeneralReportCatalog = (params) => {
  params.head.transCode = 'queryGeneralReportCatalog';
  return request({
    url: '/general/generalReportCatalog/queryGeneralReportCatalog',
    method: 'post',
    data: params
  })
}
//多条列表查询，支持条件查询
export const queryGeneralReportCatalogListPage = (params) => {
  params.head.transCode = 'queryGeneralReportCatalogListPage';
  return request({
    url: '/general/generalReportCatalog/queryGeneralReportCatalogListPage',
    method: 'post',
    data: params
  })
}
//新增单条记录
export const saveGeneralReportCatalog = (params) => {
  params.head.transCode = 'saveGeneralReportCatalog';
  return request({
    url: '/general/generalReportCatalog/saveGeneralReportCatalog',
    method: 'post',
    data: params
  })
}
//新增多条记录
export const saveGeneralReportCatalogList = (params) => {
  params.head.transCode = 'saveGeneralReportCatalogList';
  return request({
    url: '/general/generalReportCatalog/saveGeneralReportCatalogList',
    method: 'post',
    data: params
  })
}
//新增或修改单条记录
export const saveOrUpdateGeneralReportCatalog = (params) => {
  params.head.transCode = 'saveOrUpdateGeneralReportCatalog';
  return request({
    url: '/general/generalReportCatalog/saveOrUpdateGeneralReportCatalog',
    method: 'post',
    data: params
  })
}


//新增或修改单条记录
export const saveOrUpdateGeneralReportCatalogList = (params) => {
  params.head.transCode = 'saveOrUpdateGeneralReportCatalogList';
  return request({
    url: '/general/generalReportCatalog/saveOrUpdateGeneralReportCatalogList',
    method: 'post',
    data: params
  })
}

//修改单条记录
export const updateGeneralReportCatalog = (params) => {
  params.head.transCode = 'updateGeneralReportCatalog';
  return request({
    url: '/general/generalReportCatalog/updateGeneralReportCatalog',
    method: 'post',
    data: params
  })
}

//删除单条记录
export const deleteGeneralReportCatalog = (params) => {
  params.head.transCode = 'deleteGeneralReportCatalog';
  return request({
    url: '/general/generalReportCatalog/deleteGeneralReportCatalog',
    method: 'post',
    data: params
  })
}

//删除多条记录
export const deleteGeneralReportCatalogList = (params) => {
  params.head.transCode = 'deleteGeneralReportCatalogList';
  return request({
    url: '/general/generalReportCatalog/deleteGeneralReportCatalogList',
    method: 'post',
    data: params
  })
}
//导出excel
export const exportGeneralReportCatalogExcel = (params) => {
  downloadExcel({
    url: '/general/generalReportCatalog/excelDownload/exportGeneralReportCatalogExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}
//查询树形目录
export const queryReportCatalogTree = (params) => {
  params.head.transCode = 'queryFileCatalogTree';
  return request({
    url: '/general/generalReportCatalog/queryReportCatalogTree',
    method: 'post',
    data: params
  })
}